package com.atguigu.javase.javase;

/**
 * 1.用户无法直接创建被代理对象,必须创建代理对象来使用
 */
interface HouseRent {
    void rent();
}

//被代理对象
class FangDong implements HouseRent {

    @Override
    public void rent() {
        System.out.println("我有房子要出租,婚房,电话:18911652041");
    }
}

//代理类 链家
class LianJia implements HouseRent {

    private FangDong obj = new FangDong();

    @Override
    public void rent() {
        System.out.println("要想租房,先交服务费8888");
        obj.rent();
        System.out.println("准时交房租,不然收房子了");
    }
}


public class ProxyTest {

    public static void main(String[] args) {
//        new FangDong()

        LianJia lj = new LianJia();
        lj.rent();

    }
}
